<?php
/**
 * Pertyler DatabaseManagement
 * Control
 * ChangePassword
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pertyler;

require_once __DIR__ . '/main.php';

require_once __DIR__ . '/../databaseModel/Role.php';

if(isset($_POST['ChangePassword']))
	if($_POST['ChangePassword'] == 'Submit')
		if($_POST['NewPassword'] == $_POST['SameNewPassword'])
			if($moderator = Role_Moderator::Select())
				Role_Moderator::Select()->UpdatePassword($_POST['Password'],
						$_POST['NewPassword']);

unset($moderator);

echo \Pert\Page::Get()->HeaderHTML();

require __DIR__ . '/../view/ChangePassword.php';

echo \Pert\Page::Get()->FooterHTML();

return true;
